<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
application.setAttribute("aaa","bbb");

	//当前页数
	int pageNum = Integer.parseInt(request.getAttribute("pageNum")
			.toString());
	//每页多少行
	int totalPerPage = Integer.parseInt(request.getAttribute(
			"totalPerPage").toString());
	//数据总数
	int totalNum = Integer.parseInt(request.getAttribute("totalNum")
			.toString());
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Pagination</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
  </head>
  
  <body>
    当前页：<%=pageNum%> || 每页<%=totalPerPage%>行 || 数据总数：<%=totalNum%><br>
 
 Pagination Console:
 <br/>
 <%
 	int totalPage = totalNum / totalPerPage;
 	if (totalNum % totalPerPage > 0) {
 		totalPage += 1;
 	}
 %>
<a href="/Page?pageNum=1">首页</a> <a href="/Page?pageNum=<%=pageNum==1?1:pageNum-1 %>">上一页</a>
 第
		<%
			for (int i = 0; i < totalPage; i++) {
		%>
		<a href="/Page?pageNum=<%=i+1 %>"><%=i+1 %></a>  
		<%
			}
		%>
页 <a href="/Page?pageNum=<%=pageNum==totalPage?totalPage:pageNum+1 %>">下一页</a> <a href="/Page?pageNum=<%=totalPage %>">末页</a>
	</body>
</html>
